package com.dk.factory;

import com.dk.action.*;
import com.dk.enumerate.HttpEnum;
import com.dk.util.http.req.*;

/**
 * 请求工厂
 */
public class ReqFactory extends AbstractFactory{
    @Override
    public ActionStrategy getAction(String actionType) {
        return null;
    }

    /**
     * 根据请求方式获取请求对象
     * @param method 请求方式
     * @return
     */
    @Override
    public ReqStrategy getReq(String method) {
        if(method == null){
            return null;
        }
        if(method.equals(HttpEnum.GET.getValue())){
            return new GetHandler();
        } else if(method.equals(HttpEnum.POST.getValue())){
            return new PostHandler();
        } else if(method.equals(HttpEnum.PUT.getValue())){
            return new PutHandler();
        } else if(method.equals(HttpEnum.DELETE.getValue())){
            return new DeleteHandler();
        }
        return null;
    }
}
